package flc.ast.adapter;


import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;

import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.picselect.entity.SelectMediaEntity;

import flc.ast.R;
import flc.ast.bean.MyVideoBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.utils.TimeUtil;

public class PriVideoAdapter extends StkProviderMultiAdapter<MyVideoBean> {

    public boolean hasQuery;
    public String keyWord;

    public PriVideoAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new PriVideoProvider());
    }

    private class PriVideoProvider extends BaseItemProvider<MyVideoBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_video;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyVideoBean bean) {
            Glide.with(getContext()).load(bean.getPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivSelVideoItemImg));
            baseViewHolder.setText(R.id.tvSelVideoItemName, bean.getName());
            baseViewHolder.setText(R.id.tvSelVideoItemSize, ConvertUtils.byte2FitMemorySize(bean.getSize(), 0));
            baseViewHolder.setText(R.id.tvSelVideoItemDuration, TimeUtil.getMmss(bean.getDuration()));
        }
    }

}
